<template>
  <view class="custom-textarea">
    <tm-input
      v-model.lazy="inputStr"
      v-bind="$attrs"
      focusColor="#1f2329"
      confirm-hold
      confirm-type="换行"
      type="textarea"
      :inputPadding="[20]"
    ></tm-input>
  </view>
</template>

<!-- function inputHandler(e: CustomEvent) {
  // #ifndef MP-WEIXIN
  _value.value = e.detail.value;
  // #endif
  if (props.type == "textarea") {
    const str = formatValue(e.detail.value);
    e.detail.value = str;
    // #ifndef MP-WEIXIN
    _value.value = e.detail.value;
    // #endif
  }
  emits("input", e.detail.value);
  emits("update:modelValue", e.detail.value);

  return e.detail.value;
}
function formatValue(value: string) {
  const { showCharNumber, maxlength } = props;
  if (showCharNumber && maxlength !== -1 && value.length > maxlength) {
    return value.toString().substring(0, maxlength);
  }
  return value;
} -->
<script setup lang="ts">
import { ref, watch } from "vue";

const props = defineProps({
  modelValue: {
    type: String,
    default: ""
  }
});

const inputStr = ref("");

function getRemarkContent() {
  return inputStr.value;
}

defineExpose({
  getRemarkContent
});
watch(
  () => props.modelValue,
  (val) => {
    inputStr.value = val;
  }
);
</script>

<style lang="scss" scoped>
.custom-textarea {
  background-color: white;
  padding: 20rpx;
}
</style>
